package com.tanhua.server.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
//实现WebMvcConfigurer接口中的addInterceptors方法把自定义的拦截器类添加进来即可

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //把自己定义的拦截器添加进去
        registry.addInterceptor(new TokenInterceptor())
                //拦截所有的请求路径
                .addPathPatterns("/**")
                //去除登录，验证码判断
                .excludePathPatterns(new String[]{"/user/login",
                "/user/loginVerification"});
    }
}
